import i18n from '@/locales'
// 管理员密码选择配置
export const LOGIN_TYPES_MAP = {
  random: {
    label: i18n.t('db.text_1'),
    key: 'random',
  },
  keypair: {
    label: i18n.t('db.text_2'),
    key: 'keypair',
  },
  image: {
    label: i18n.t('db.text_3'),
    key: 'image',
  },
  password: {
    label: i18n.t('db.text_4'),
    key: 'password',
  },
}

export const RDS_ACCOUNT_PRIVILEGES = {
  rw: i18n.t('db.text_5'),
  r: i18n.t('db.text_6'),
  ddl: i18n.t('db.text_7'),
  dml: i18n.t('db.text_8'),
  owner: i18n.t('db.text_9'),
  custom: i18n.t('db.text_10'),
}

export const RDS_MONITOR_OPTS = {
  aliyun: [
    {
      name: 'cpu',
      label: i18n.t('db.text_11'),
      seleteItem: 'usage_active',
      fromItem: 'rds_cpu',
      as: i18n.t('db.text_11'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mem',
      label: i18n.t('db.text_12'),
      seleteItem: 'used_percent',
      fromItem: 'rds_mem',
      as: i18n.t('db.text_12'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'disk',
      label: i18n.t('db.text_13'),
      seleteItem: 'used_percent',
      as: i18n.t('db.text_13'),
      fromItem: 'rds_disk',
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mysql_bps_recv',
      label: i18n.t('db.text_14'),
      seleteItem: 'bps_recv',
      fromItem: 'rds_netio',
      as: i18n.t('db.text_14'),
      unit: 'bps',
      transfer: 1000,
      tags: {
        tag: 'mysql',
      },
    },
    {
      name: 'mysql_bps_sent',
      label: i18n.t('db.text_15'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_15'),
      fromItem: 'rds_netio',
      unit: 'bps',
      transfer: 1000,
      tags: {
        tag: 'mysql',
      },
    },
    {
      name: 'mysql_bps_recv',
      label: i18n.t('db.text_16'),
      seleteItem: 'bps_recv',
      fromItem: 'rds_netio',
      as: i18n.t('db.text_16'),
      unit: 'bps',
      transfer: 1000,
      tags: {
        tag: 'sqlserver',
      },
    },
    {
      name: 'sql_bps_sent',
      label: i18n.t('db.text_17'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_17'),
      fromItem: 'rds_netio',
      unit: 'bps',
      transfer: 1000,
      tags: {
        tag: 'sqlserver',
      },
    },
    {
      name: 'conn',
      label: i18n.t('db.text_18'),
      seleteItem: 'usage_active',
      as: i18n.t('db.text_13'),
      fromItem: 'rds_conn',
      unit: '%',
      transfer: 1,
    },
  ],
  huawei: [
    {
      name: 'cpu',
      label: i18n.t('db.text_11'),
      seleteItem: 'usage_active',
      fromItem: 'rds_cpu',
      as: i18n.t('db.text_11'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mem',
      label: i18n.t('db.text_12'),
      seleteItem: 'used_percent',
      fromItem: 'rds_mem',
      as: i18n.t('db.text_12'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'bps_recv',
      label: i18n.t('db.text_19'),
      seleteItem: 'bps_recv',
      fromItem: 'rds_netio',
      as: i18n.t('db.text_19'),
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'bps_sent',
      label: i18n.t('db.text_20'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_20'),
      fromItem: 'rds_netio',
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'disk',
      label: i18n.t('db.text_13'),
      seleteItem: 'used_percent',
      as: i18n.t('db.text_13'),
      fromItem: 'rds_disk',
      unit: '%',
      transfer: 1,
    },
    {
      name: 'conn',
      label: i18n.t('db.text_18'),
      seleteItem: 'usage_active',
      as: i18n.t('db.text_13'),
      fromItem: 'rds_conn',
      unit: '%',
      transfer: 1,
    },
  ],
  qcloud: [
    {
      name: 'cpu',
      label: i18n.t('db.text_11'),
      seleteItem: 'usage_active',
      fromItem: 'rds_cpu',
      as: i18n.t('db.text_11'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mem',
      label: i18n.t('db.text_12'),
      seleteItem: 'used_percent',
      fromItem: 'rds_mem',
      as: i18n.t('db.text_12'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'bps_recv',
      label: i18n.t('db.text_19'),
      seleteItem: 'bps_recv',
      fromItem: 'rds_netio',
      as: i18n.t('db.text_19'),
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'bps_sent',
      label: i18n.t('db.text_20'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_20'),
      fromItem: 'rds_netio',
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'disk',
      label: i18n.t('db.text_13'),
      seleteItem: 'used_percent',
      as: i18n.t('db.text_13'),
      fromItem: 'rds_disk',
      unit: '%',
      transfer: 1,
    },
    {
      name: 'conn',
      label: i18n.t('db.text_18'),
      seleteItem: 'used_percent',
      as: i18n.t('db.text_18'),
      fromItem: 'rds_conn',
      unit: '%',
      transfer: 1,
    },
  ],
  jdcloud: [
    {
      name: 'cpu',
      label: i18n.t('db.text_11'),
      seleteItem: 'usage_active',
      fromItem: 'rds_cpu',
      as: i18n.t('db.text_11'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mem',
      label: i18n.t('db.text_12'),
      seleteItem: 'used_percent',
      fromItem: 'rds_mem',
      as: i18n.t('db.text_12'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'bps_recv',
      label: i18n.t('db.text_19'),
      seleteItem: 'bps_recv',
      fromItem: 'rds_netio',
      as: i18n.t('db.text_19'),
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'bps_sent',
      label: i18n.t('db.text_20'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_20'),
      fromItem: 'rds_netio',
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'disk',
      label: i18n.t('db.text_13'),
      seleteItem: 'used_percent',
      as: i18n.t('db.text_13'),
      fromItem: 'rds_disk',
      unit: '%',
      transfer: 1,
    },
    {
      name: 'conn',
      label: i18n.t('db.text_18'),
      seleteItem: 'used_percent',
      as: i18n.t('db.text_18'),
      fromItem: 'rds_conn',
      unit: '%',
      transfer: 1,
    },
  ],
}

export const REDIS_MONITOR_OPTS = {
  aliyun: [
    {
      name: 'cpu',
      label: i18n.t('db.text_11'),
      seleteItem: 'usage_percent',
      fromItem: 'dcs_cpu',
      as: i18n.t('db.text_11'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mem',
      label: i18n.t('db.text_12'),
      seleteItem: 'used_percent',
      fromItem: 'dcs_mem',
      as: i18n.t('db.text_12'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'dcs_bps_recv',
      label: i18n.t('db.text_21'),
      seleteItem: 'bps_recv',
      fromItem: 'dcs_netio',
      as: i18n.t('db.text_21'),
      unit: 'bps',
      transfer: 1000,
    },
    {
      name: 'dcs_bps_sent',
      label: i18n.t('db.text_22'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_22'),
      fromItem: 'dcs_netio',
      unit: 'bps',
      transfer: 1000,
    },

    {
      name: 'used_conn',
      label: i18n.t('db.text_23'),
      seleteItem: 'used_conn',
      as: i18n.t('db.text_23'),
      fromItem: 'used_conn',
      unit: '',
      transfer: 1,
    },
    {
      name: 'opt_sec',
      label: i18n.t('db.text_24'),
      seleteItem: 'opt_sec',
      as: i18n.t('db.text_24'),
      fromItem: 'dcs_instantopt',
      unit: '',
      transfer: 1,
    },
    {
      name: 'key_count',
      label: i18n.t('db.text_25'),
      seleteItem: 'key_count',
      as: i18n.t('db.text_25'),
      fromItem: 'dcs_cachekeys',
      unit: '',
      transfer: 1,
    },
    {
      name: 'key_count',
      label: i18n.t('db.text_26'),
      seleteItem: 'key_count',
      as: i18n.t('db.text_26'),
      fromItem: 'dcs_cachekeys',
      unit: '',
      transfer: 1,
      tags: {
        exp: 'expire',
      },
    },
    {
      name: 'used_byte',
      label: i18n.t('db.text_27'),
      seleteItem: 'used_byte',
      as: i18n.t('db.text_27'),
      fromItem: 'dcs_datamem',
      unit: '',
      transfer: 1024,
    },
  ],
  huawei: [
    {
      name: 'cpu',
      label: i18n.t('db.text_11'),
      seleteItem: 'usage_percent',
      fromItem: 'dcs_cpu',
      as: i18n.t('db.text_11'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mem',
      label: i18n.t('db.text_12'),
      seleteItem: 'used_percent',
      fromItem: 'dcs_mem',
      as: i18n.t('db.text_12'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'bps_recv',
      label: i18n.t('db.text_21'),
      seleteItem: 'bps_recv',
      fromItem: 'dcs_netio',
      as: i18n.t('db.text_21'),
      unit: 'bps',
      transfer: 1000,
    },
    {
      name: 'bps_sent',
      label: i18n.t('db.text_22'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_22'),
      fromItem: 'dcs_netio',
      unit: 'bps',
      transfer: 1000,
    },
    {
      name: 'used_conn',
      label: i18n.t('db.text_23'),
      seleteItem: 'used_conn',
      as: i18n.t('db.text_13'),
      fromItem: 'dcs_conn',
      unit: '',
      transfer: 1,
    },
    {
      name: 'conn',
      label: i18n.t('db.text_24'),
      seleteItem: 'opt_sec',
      as: i18n.t('db.text_24'),
      fromItem: 'dcs_instantopt',
      unit: '',
      transfer: 1,
    },
    {
      name: 'keys',
      label: i18n.t('db.text_25'),
      seleteItem: 'key_count',
      as: i18n.t('db.text_25'),
      fromItem: 'dcs_cachekeys',
      unit: '',
      transfer: 1,
    },
    {
      name: 'expires',
      label: i18n.t('db.text_26'),
      seleteItem: 'key_count',
      as: i18n.t('db.text_26'),
      fromItem: 'dcs_cachekeys',
      unit: '',
      transfer: 1,
      tags: {
        tag: 'expire',
      },
    },
    {
      name: 'used_memory_dataset',
      label: i18n.t('db.text_27'),
      seleteItem: 'used_byte',
      as: i18n.t('db.text_27'),
      fromItem: 'dcs_datamem',
      unit: 'B',
      transfer: 1024,
    },
  ],
  qcloud: [
    {
      name: 'cpu',
      label: i18n.t('db.text_11'),
      seleteItem: 'usage_active',
      fromItem: 'dcs_cpu',
      as: i18n.t('db.text_11'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'mem',
      label: i18n.t('db.text_12'),
      seleteItem: 'used_percent',
      fromItem: 'dcs_mem',
      as: i18n.t('db.text_12'),
      unit: '%',
      transfer: 1,
    },
    {
      name: 'bps_recv',
      label: i18n.t('db.text_19'),
      seleteItem: 'bps_recv',
      fromItem: 'dcs_netio',
      as: i18n.t('db.text_19'),
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'bps_sent',
      label: i18n.t('db.text_20'),
      seleteItem: 'bps_sent',
      as: i18n.t('db.text_20'),
      fromItem: 'dcs_netio',
      unit: 'bps',
      transfer: 1024,
    },
    {
      name: 'conn',
      label: i18n.t('db.text_18'),
      seleteItem: 'used_percent',
      as: i18n.t('db.text_18'),
      fromItem: 'dcs_conn',
      unit: '%',
      transfer: 1,
    },
  ],
}
